package cn.edu.zut.hhr.controller;


import cn.edu.zut.hhr.annotation.LogAnnotation;
import cn.edu.zut.hhr.entity.Tag;
import cn.edu.zut.hhr.service.TagService;
import cn.edu.zut.hhr.vo.RestResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 标签表 前端控制器
 * </p>
 *
 * @author HHR
 * @since 2021-08-21
 */
@RestController
@RequestMapping("/tags")
public class TagController {

    @Resource
    private TagService tagService;

    @GetMapping("/hot/{count}")
    @LogAnnotation(module = "标签",operator = "获取热门标签")
    public RestResponse getHotTags(@PathVariable("count") int count){
        List<Tag> tags = tagService.getHotTags(count);
        return RestResponse.success(tags);
    }

    @GetMapping("/all")
    @LogAnnotation(module = "标签",operator = "获取全部标签")
    public RestResponse getAllTags(){
        return tagService.getAllTags();
    }

}
